package com.example.demo.websoket.entity;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.UUID;

/**
 * @author 彭长云
 * @Description:消息发送类
 * @date 2019/2/28 10:27
 */
public class WsMessage {
    /**个人接收*/
    public final static int RECEIVER_TYPE_ORG = 1;
    /**组织接收*/
    public final static int RECEIVER_TYPE_PERSON = 2;
    /**所有人，广播消息*/
    public final static int RECEIVER_TYPE_ALL = 3;
    //消息ID
    private String id;
    //消息内容
    private Object content;
    //消息时间
    private String createTime;
    //组织code
    private String receOrgCode;
    //用户code
    private String recePersonCode;
    //发送者
    private String sender;
    //接收者类型
    private int receiverType;
    //消息类型
    private String msgType;

    public WsMessage(Object content, String receOrgCode, String recePersonCode, String sender, int receiverType, String msgType) {
        this.content = content;
        this.receOrgCode = receOrgCode;
        this.recePersonCode = recePersonCode;
        this.sender = sender;
        this.receiverType = receiverType;
        this.msgType = msgType;
        this.id = UUID.randomUUID().toString();
        this.createTime = LocalDateTime.now().toString();
    }

    public WsMessage() {
        this.id = UUID.randomUUID().toString();
        this.createTime = LocalDateTime.now().toString();
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Object getContent() {
        return content;
    }

    public void setContent(Object content) {
        this.content = content;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getReceOrgCode() {
        return receOrgCode;
    }

    public void setReceOrgCode(String receOrgCode) {
        this.receOrgCode = receOrgCode;
    }

    public String getRecePersonCode() {
        return recePersonCode;
    }

    public void setRecePersonCode(String recePersonCode) {
        this.recePersonCode = recePersonCode;
    }

    public String getSender() {
        return sender;
    }

    public void setSender(String sender) {
        this.sender = sender;
    }

    public int getReceiverType() {
        return receiverType;
    }

    public void setReceiverType(int receiverType) {
        this.receiverType = receiverType;
    }

    public String getMsgType() {
        return msgType;
    }

    public void setMsgType(String msgType) {
        this.msgType = msgType;
    }
}
